/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ASAExpr;

import exception.DivisionByZeroException;
import exception.VariableNonDeclareeException;

/**
 *
 * @author FM & KB
 */
public class ASAExprAffectationEgal extends ASAExprAffectation {

    public ASAExprAffectationEgal(ASAExprRecupIdent e1, ASAExpr e2) {
        super(e1, e2);
    }

    @Override
    public int evalue() throws VariableNonDeclareeException, DivisionByZeroException {
        int temp = valeur.evalue();
        try {
            variable.recupVariable().setValeur(temp);
        } catch (VariableNonDeclareeException vnde) {
            System.out.println(vnde.getMessage());
        }
        return temp;
    }

    @Override
    public String getLabelExplorateur() {
        return "AFFECT_EGAL";
    }
    
    @Override
    public ASAExpr simplifie() throws VariableNonDeclareeException, DivisionByZeroException {
        ASAExpr valeur_simpl = valeur.simplifie();
        return new ASAExprAffectationEgal(variable, valeur_simpl);
    }

}
